#include "parser.h"

ParserPtr Parser::parser_ = nullptr;

ParserPtr Parser::getInst()
{
    if (!parser_)
    {
        parser_ = new Parser();
    }
    return parser_;
}

void Parser::parse(const Protocol &proto)
{
    switch (proto.behavior_)
    {
    case Behavior::CD:
        doCD(proto.buf_);
        break;
    case Behavior::LS:
        break;
    case Behavior::REMOVE:
        break;
    case Behavior::LOGIN:
        break;
    case Behavior::REGISTER:
        break;
    case Behavior::MKDIR:
        break;
    case Behavior::PWD:
        break;
    case Behavior::TOKEN:
        break;
    case Behavior::TRANSFER:
        break;
    case Behavior::GETS:
        break;
    case Behavior::PUTS:
        break;
    default:
        doOther(proto.buf_);
    }
}

void Parser::doCD(const char *buf)
{
}

void Parser::doOther(const char *buf)
{
#ifdef DEBUG
    cerr << "request is err..." << endl;
#endif
}

Parser::Parser()
{
}

Parser::~Parser()
{
}